/*
 * BinEncoder.c
 *
 *  Created on: 2012. 5. 9.
 *      Author: yjpark
 */

#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdint.h>
#include <netinet/in.h>
#include "Protocol.h"

// complete
size_t Bin_Encode(uint8_t *outBuf, size_t bufSize, FILE *fp) {

	long mSize = fread(outBuf, sizeof(uint8_t), bufSize, fp);

	if(mSize < 0)
		return -1;

	return (size_t) mSize;
}

// complete
bool Bin_Decode(uint8_t *inBuf, uint8_t *tMsgs, size_t bufSize) {

	memcpy((char *)tMsgs, inBuf, sizeof(uint8_t)*bufSize);
	size_t mSize = strlen(tMsgs);

	if(mSize < 0)
		return false;

	return true;
}
